package com.ruoyi.basicData.client.service.impl;

import java.util.List;

import com.kingdee.bos.webapi.sdk.K3CloudApi;
import com.ruoyi.basicData.client.domain.Client;
import com.ruoyi.basicData.client.mapper.ClientMapper;
import com.ruoyi.basicData.client.service.IClientService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.sync.BaseService;
import com.ruoyi.syncCore.SyncCoreTemplate;
import com.ruoyi.interfaceConfig.sceneConfig.service.ISceneConfigService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 客户管理Service业务层处理
 * 
 * @author YiYuan
 * @date 2024-01-27
 */
@Service
@RequiredArgsConstructor
public class ClientServiceImpl extends BaseService implements IClientService
{
    private final ClientMapper clientMapper;
    private final K3CloudApi k3CloudApi;
    private final ISceneConfigService sceneConfigService;
    private final SyncCoreTemplate syncCoreTemplate;

    /**
     * 查询客户管理
     * 
     * @param clientId 客户管理主键
     * @return 客户管理
     */
    @Override
    public Client selectClientByClientId(String clientId)
    {
        return clientMapper.selectClientByClientId(clientId);
    }

    /**
     * 查询客户管理列表
     * 
     * @param client 客户管理
     * @return 客户管理
     */
    @Override
    public List<Client> selectClientList(Client client)
    {
        return clientMapper.selectClientList(client);
    }

    /**
     * 新增客户管理
     * 
     * @param client 客户管理
     * @return 结果
     */
    @Override
    public int insertClient(Client client)
    {
        client.setClientId(IdUtils.fastUUID());
        client.setCreateTime(DateUtils.getNowDate());
        return clientMapper.insertClient(client);
    }

    /**
     * 修改客户管理
     * 
     * @param client 客户管理
     * @return 结果
     */
    @Override
    public int updateClient(Client client)
    {
        client.setUpdateTime(DateUtils.getNowDate());
        return clientMapper.updateClient(client);
    }

    /**
     * 批量删除客户管理
     * 
     * @param clientIds 需要删除的客户管理主键
     * @return 结果
     */
    @Override
    public int deleteClientByClientIds(String[] clientIds)
    {
        return clientMapper.deleteClientByClientIds(clientIds);
    }

    /**
     * 删除客户管理信息
     * 
     * @param clientId 客户管理主键
     * @return 结果
     */
    @Override
    public int deleteClientByClientId(String clientId)
    {
        return clientMapper.deleteClientByClientId(clientId);
    }


    /**
     * 组件所需模糊查询
     * @param keyWord
     * @return
     */
    @Override
    public List<Client> selectClientListByKeyWord(String keyWord) {
        return clientMapper.selectClientListNyKeyWord(keyWord);
    }
}
